package com.aliyun.heiyu.powermaster.server.dao.impl;

import com.aliyun.heiyu.common.util.JdbcUtil;
import com.aliyun.heiyu.powermaster.server.dao.BreaklineDao;
import com.aliyun.heiyu.powermaster.server.dao.entity.BreaklineEntity;

import java.util.List;

public class BreaklineImpl implements BreaklineDao {
    @Override
    public List<BreaklineEntity> findByTime(String sn, String startTime, String endTime) {
        String sql1 = "select id,time_start,time_end,breakline_type,breakline_comment,breakline_device " +
            "from breakline where breakline_device = ? and time_start <= ? and time_end >= ?";
        String[] kk = new String[3];
        kk[0] = sn;
        kk[1] = endTime;
        kk[2] = startTime;
        List<BreaklineEntity> result = JdbcUtil.queryForList(sql1, kk, BreaklineEntity.class);
        return result;
    }

    public BreaklineEntity findOne(int id) {
        String sql = "select * from breakline where id =1 ";
        return JdbcUtil.queryForBean(sql, null, BreaklineEntity.class);
    }
}
